#pragma once
#include <opencv2/dnn/dnn.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <onnxruntime_cxx_api.h>

#include <chrono>
#include <cmath>
#include <exception>
#include <fstream>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <queue>
#include <vector>
#include "base_util/utils.h"

#include "common/model_config.h"
#include "onnx/base/onnx_predictor.h"
#include "onnx/onnxmodel_manager.h"

namespace ai {

class ONNXDetPredictor : public ONNXPredictor {
public:
  ONNXDetPredictor(ONNXPackPredictor* model, ONNXModelManager* mng, LogInfo *lg);
  ~ONNXDetPredictor();


private:
  int RunDet(stream::ImageBlob* blob, std::vector<BaseInfo*>& det_infos) ;
  int GetConvDetectionResult(stream::ImageBlob& img_blob, std::vector<BaseInfo*>& det_infos);
  int GetConvDetectionResult_nosigmoid(stream::ImageBlob& img_blob, std::vector<BaseInfo*>& det_infos);
  int GetConvDetectionResult_paddle(stream::ImageBlob& img_blob, std::vector<BaseInfo*>& det_infos);
  int GetConvDetectionResult_plate(stream::ImageBlob& img_blob, std::vector<BaseInfo*>& det_infos);


private:
  std::vector<float> MeshGrid;
  int HeadNum;
  int TopK = 50;
  std::vector<float*> outputs;
  std::vector<int> outputs_size;

};


}